#include <iostream>
using namespace std;


int main () {
    string in;
    char c;
    while(getline(cin, in)) {
        if (in.length() <= 0) continue;
        c = getchar();
        cout << in << "---" << in.length() << "---" << c << endl;
        const char* tmp = in.c_str();
        int count = 0;
        int length = in.length();
        for (int i = 0; i < length; i++) {
            cout << tmp[i] << "---" << (tmp[i] - c) << endl;
            if ((abs(tmp[i] - c) == 32) || abs(tmp[i] - c) == 0) count++;
        }
        cout << count << endl;
    }
    return 0;
}